package aerouacmsla.interfazDeUsuario;
import aerouacmsla.entidad.Vuelo;
import aerouacmsla.procedimientos.BDConexion;
import java.sql.SQLException;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import java.text.SimpleDateFormat;
import javax.swing.DefaultComboBoxModel;
import java.util.logging.Level;
import java.util.logging.Logger;
import aerouacmsla.procedimientos.GeneradorIdes;
import aerouacmsla.entidad.Ciudad;
//import java.sql.SQLException;
//import javax.swing.JDialog;
import aerouacmsla.procedimientos.CreateTables;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import javax.swing.SpinnerDateModel;
/**
 *
 * @author six
 */
public class VentanaNuevoVuelo extends javax.swing.JDialog {
    private BDConexion miConexion;
    Vuelo vueloActual = new Vuelo();
    Ciudad origenActual = new Ciudad();
    Ciudad destinoActual = new Ciudad();
    private boolean comboinactivo=true;
    private CreateTables modeloTabla = new CreateTables();

    public CreateTables getModeloTabla() {
        return modeloTabla;
    }

    public void setModeloTabla(CreateTables modeloTabla) {
        this.modeloTabla = modeloTabla;
    }


    /** Creates new form NewJDialog */
    public VentanaNuevoVuelo() {
        initComponents();
    }
    public VentanaNuevoVuelo(BDConexion miConexion) {
        initComponents();
        jButton3.setText("Registrar");
        setMiConexion(miConexion);
        setModal(true);
        try{
        if(getMiConexion().sendSQLQuery("SELECT id_avion FROM avion where id_estado=3").next()){
        getMiConexion().sendSQLQuery("SELECT id_avion FROM avion where id_estado=3");
        comboAvion.setModel(new DefaultComboBoxModel(getMiConexion().getLastResultSetColumnStrings("id_avion")));
        comboinactivo=false;
        } else {comboAvion.setModel(new DefaultComboBoxModel());
        comboinactivo=true;
        }
        }catch (SQLException ex) {
                              Logger.getLogger(PanelAdministrarCiudades.class.getName()).log(Level.SEVERE, null, ex);
                          }
    }
    public VentanaNuevoVuelo(Vuelo v, BDConexion miConexion) {
        initComponents();
        //System.out.println(v.getHoraSalida());
        labelIdVuelo.setText(v.getIdVuelo());
        textAsientosDisponibles.setText(String.valueOf(v.getAsientosDisponibles()));
        datePickerFecha.getEditor().setText(v.getFechaSalida());
        //Calendar fecha = new GregorianCalendar();
        //String hora[]= v.getHoraSalida().split(":");
        //fecha.set(01, 01, 01, Integer.parseInt(hora[0]), Integer.parseInt(hora[1]), Integer.parseInt(hora[2]));
        //fecha = Calendar.getInstance();
        //fecha.set(Calendar.HOUR, Integer.parseInt(hora[0]));
        //fecha.set(Calendar.MINUTE, Integer.parseInt(hora[1]));
        //System.out.println(fecha);
//        spinerHora.setValue(fecha);

        //spinerHora.setValue(new Date(v.getHoraSalida()));
        //setToolTipText(v.getHoraSalida());
        //try {
        //comboAvion.setModel(llenarCombo(getMiConexion().getLastResultSetColumnStrings("id_vuelo")));
        textOrigen.setText(v.getOrigen());
        textDestino.setText(v.getDestino());
        textEstado.setText(v.getEstado());
        textPrecio.setText(String.valueOf(v.getPrecio()));
        jButton3.setText("Modificar");
        setMiConexion(miConexion);
        setModal(true);
                try{
        if(getMiConexion().sendSQLQuery("SELECT id_avion FROM avion where id_estado=3").next()){
        getMiConexion().sendSQLQuery("SELECT id_avion, numero_asientos FROM avion where id_estado=3");
        comboAvion.setModel(new DefaultComboBoxModel(getMiConexion().getLastResultSetColumnStrings("id_avion")));
        getMiConexion().getResultado().beforeFirst();
        getMiConexion().getResultado().next();
        textAsientosDisponibles.setText(getMiConexion().getResultado().getInt("numero_asientos") + "");
        comboinactivo=false;
        } else {comboAvion.setModel(new DefaultComboBoxModel());
        comboinactivo=true;
        }
        }catch (SQLException ex) {
                              Logger.getLogger(PanelAdministrarCiudades.class.getName()).log(Level.SEVERE, null, ex);
                          }
    }
    public BDConexion getMiConexion() {
        return miConexion;
    }

    public void setMiConexion(BDConexion miConexion) {
        this.miConexion = miConexion;
    }
    /*    public DefaultComboBoxModel llenarCombo(String[] elementos) {
        DefaultComboBoxModel comboModelo = new DefaultComboBoxModel();
        if (elementos != null) {
            for (int i = 0; i<elementos.length; i++){
                comboModelo.addElement(elementos[i]);
            }
            //comboModelo = new DefaultComboBoxModel(elementos);
            return comboModelo;
        }
        return comboModelo;
    }

    public void llenarComboAviones(){
        if (!campoOrigen.getText().isEmpty() && !campoDestino.getText().isEmpty()){
            getMiConexion().sendSQLQuery(
                    "SELECT * FROM vuelo WHERE origen = '" + getOrigen(3) +
                    "' && destino = '" + getDestino(3) + "';"
                    );
            comboVuelosDisponibles.setModel(llenarCombo(getMiConexion().getLastResultSetColumnStrings("id_vuelo")));
        }
    }*/

    


    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        topPanel = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        labelIdVuelo = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        comboAvion = new javax.swing.JComboBox();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        spinerHora = new javax.swing.JSpinner();
        datePickerFecha = new org.jdesktop.swingx.JXDatePicker();
        textOrigen = new javax.swing.JTextField();
        textDestino = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        textPrecio = new javax.swing.JFormattedTextField();
        textAsientosDisponibles = new javax.swing.JFormattedTextField();
        jButton3 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        textEstado = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Vuelo");
        setIconImage(new ImageIcon(getClass().getResource("/Recursos/Icono32px.png")).getImage());

        topPanel.setBackground(new java.awt.Color(51, 51, 51));

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 18));
        jLabel3.setForeground(new java.awt.Color(255, 255, 255));
        jLabel3.setText("Panel Registro de Vuelos");

        javax.swing.GroupLayout topPanelLayout = new javax.swing.GroupLayout(topPanel);
        topPanel.setLayout(topPanelLayout);
        topPanelLayout.setHorizontalGroup(
            topPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(topPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel3)
                .addContainerGap(303, Short.MAX_VALUE))
        );
        topPanelLayout.setVerticalGroup(
            topPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(topPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel3)
                .addContainerGap(30, Short.MAX_VALUE))
        );

        labelIdVuelo.setText("---------");

        jLabel2.setText("id:Vuelo");

        comboAvion.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                comboAvionItemStateChanged(evt);
            }
        });

        jLabel4.setText("Avion:");

        jLabel5.setText("Asientos Disponibles:");

        jLabel6.setText("Fecha:");

        jLabel7.setText("Hora Salida:");

        jLabel8.setText("Origen:");

        jLabel9.setText("Destino:");

        jLabel10.setText("Precio:");

        spinerHora.setModel(new javax.swing.SpinnerDateModel());
        spinerHora.setEditor(new javax.swing.JSpinner.DateEditor(spinerHora, "HH:MM"));

        datePickerFecha.setFormats(new SimpleDateFormat("yyyy-MM-dd"));

        textOrigen.setEditable(false);

        textDestino.setEditable(false);

        jButton1.setText("...");
        jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MouseClicked(evt);
            }
        });

        jButton2.setText("...");
        jButton2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton2MouseClicked(evt);
            }
        });

        textPrecio.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#.#"))));

        textAsientosDisponibles.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0"))));

        jButton3.setText("Aceptar");
        jButton3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton3MouseClicked(evt);
            }
        });

        jLabel1.setText("EstadoAvion:");

        textEstado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textEstadoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(topPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel7)
                    .addComponent(jLabel6)
                    .addComponent(jLabel2)
                    .addComponent(jLabel4)
                    .addComponent(jLabel5)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLabel8)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel10)
                            .addComponent(jLabel9))))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(textAsientosDisponibles, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jButton3)
                                    .addComponent(textPrecio, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addComponent(jLabel1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(textEstado, javax.swing.GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE))
                            .addComponent(textDestino, javax.swing.GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE)
                            .addComponent(textOrigen, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(labelIdVuelo)
                                .addComponent(datePickerFecha, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(comboAvion, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(spinerHora)))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jButton1, 0, 0, Short.MAX_VALUE)
                            .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 22, Short.MAX_VALUE))
                        .addGap(91, 91, 91))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(topPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelIdVuelo)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(comboAvion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(textAsientosDisponibles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(datePickerFecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel7)
                    .addComponent(spinerHora, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(textOrigen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(textDestino, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(textPrecio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1)
                    .addComponent(textEstado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jButton3)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
DialogoCiudades eleccionOrigen = new DialogoCiudades(getMiConexion());
        eleccionOrigen.setVisible(true);
        origenActual.setPais(eleccionOrigen.getPais());
        origenActual.setEstado(eleccionOrigen.getEstado());
        origenActual.setCiudad(eleccionOrigen.getCiudad());
        origenActual.setId(eleccionOrigen.getId());
        textOrigen.setText(origenActual.getId());
        if(!textDestino.getText().toString().isEmpty()){
            if(origenActual.getId().equals(destinoActual.getId())){
                JOptionPane.showMessageDialog(null, "El Origen no puede ser el mismo que el Destino","Campos incorrectos", JOptionPane.ERROR_MESSAGE);
            textOrigen.setText("");
            }
        }
    }//GEN-LAST:event_jButton1MouseClicked

    private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseClicked
DialogoCiudades eleccionDestino = new DialogoCiudades(getMiConexion());
        eleccionDestino.setVisible(true);
        destinoActual.setPais(eleccionDestino.getPais());
        destinoActual.setEstado(eleccionDestino.getEstado());
        destinoActual.setCiudad(eleccionDestino.getCiudad());
        destinoActual.setId(eleccionDestino.getId());
        textDestino.setText(destinoActual.getId());
        if(!textOrigen.getText().toString().isEmpty()){
            if(destinoActual.getId().equals(origenActual.getId())){
                JOptionPane.showMessageDialog(null, "El Destino no puede ser el mismo que el Origen","Campos incorrectos", JOptionPane.ERROR_MESSAGE);
            textDestino.setText("");
            }
        }
        
    }//GEN-LAST:event_jButton2MouseClicked

    private void jButton3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton3MouseClicked
    if(comboinactivo==true||textAsientosDisponibles.getText().isEmpty()||datePickerFecha.getEditor().getText().equals("")||textOrigen.getText().isEmpty()
            ||textDestino.getText().isEmpty()||textPrecio.getText().isEmpty()||textEstado.getText().isEmpty()){
        JOptionPane.showMessageDialog(null, "Todos los campos son obligatorios verifiquelos","Campos vacios", JOptionPane.ERROR_MESSAGE);
    }else{
        if(textEstado.getText().length()>10){
         JOptionPane.showMessageDialog(null, "El campo estado admite hasta 10 caracteres","Campos muy largo", JOptionPane.ERROR_MESSAGE);

        }else{
        vueloActual.setIdAvion(comboAvion.getSelectedItem().toString());
        vueloActual.setAsientosDisponibles(Integer.parseInt(textAsientosDisponibles.getText().toString()));
        vueloActual.setOrigen(origenActual.getId());
        vueloActual.setDestino(destinoActual.getId());
        vueloActual.setFechaSalida(datePickerFecha.getEditor().getText());
        vueloActual.setHoraSalida(spinerHora.getValue().toString().substring(11, 16));

        String precio = textPrecio.getText().toString();
        precio.replace(',', '.');
        
        System.out.println(precio);
        vueloActual.setPrecio(Float.parseFloat(precio));
        

        String SQL = null;
         if(jButton3.getText().equalsIgnoreCase("Registrar")){
             GeneradorIdes GI = new GeneradorIdes(origenActual, destinoActual, vueloActual.getHoraSalida(), vueloActual.getFechaSalida());
        vueloActual.setIdVuelo(GI.getId());
                SQL = "INSERT INTO vuelo VALUES ('"+getVueloActual().getIdVuelo() +"', '" + getVueloActual().getIdAvion()+
                        "', "+getVueloActual().getAsientosDisponibles()+", '"+ getVueloActual().getFechaSalida()+"', '"+
                        getVueloActual().getHoraSalida()+"', '"+getVueloActual().getOrigen()+"', '"+
                        getVueloActual().getDestino()+"', "+getVueloActual().getPrecio()+",'"+textEstado.getText()+"');";
                                             getMiConexion().sendSQL(SQL);
            JOptionPane.showMessageDialog(this,
                 "El vuelo ha sido Registrado exitosamente",
                 "Vuelo Registrado Exitosamente",
                 JOptionPane.INFORMATION_MESSAGE);
         }
            else{
                SQL = " UPDATE vuelo SET id_avion = " +
                        getVueloActual().getIdAvion() +" , asientos_disponibles ="+textAsientosDisponibles.getText() +", fecha ='" +
                        datePickerFecha.getEditor().getText()+"', hora_salida= '" + spinerHora.getValue().toString().substring(11, 16)
                        + "', origen= '" + textOrigen.getText()+"', destino ='"+textDestino.getText()+"',  precio = " + textPrecio.getText().replace(',', '.')
                        +", estado='"+textEstado.getText()+"' WHERE id_vuelo = '" + labelIdVuelo.getText() +"';";
            
                    getMiConexion().sendSQL(SQL);
            JOptionPane.showMessageDialog(this,
                 "El vuelo ha sido Modificado exitosamente",
                 "Vuelo Modificado Exitosamente",
                 JOptionPane.INFORMATION_MESSAGE);
    }

    }
        }
    }//GEN-LAST:event_jButton3MouseClicked

    private void comboAvionItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_comboAvionItemStateChanged
        String idAvion = comboAvion.getSelectedItem().toString();
        getMiConexion().sendSQLQuery("SELECT numero_asientos FROM avion WHERE id_avion =" + idAvion);
        try {
            if (getMiConexion().getResultado().next()) {
                textAsientosDisponibles.setText(getMiConexion().getResultado().getInt("numero_asientos") + "");
            }
        } catch (SQLException ex) {
            Logger.getLogger(VentanaNuevoVuelo.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_comboAvionItemStateChanged

    private void textEstadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textEstadoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_textEstadoActionPerformed


    public Vuelo getVueloActual() {
        return vueloActual;
    }

    public void setVueloActual(Vuelo vueloActual) {
        this.vueloActual = vueloActual;
    }
    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new VentanaNuevoVuelo().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox comboAvion;
    private org.jdesktop.swingx.JXDatePicker datePickerFecha;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel labelIdVuelo;
    private javax.swing.JSpinner spinerHora;
    private javax.swing.JFormattedTextField textAsientosDisponibles;
    private javax.swing.JTextField textDestino;
    private javax.swing.JTextField textEstado;
    private javax.swing.JTextField textOrigen;
    private javax.swing.JFormattedTextField textPrecio;
    private javax.swing.JPanel topPanel;
    // End of variables declaration//GEN-END:variables

}
